save

fun <T : Config> save(configClass: T)

Overload of saveManual that automatically fills in name, folder, and subfolder from the config itself.

Performs a config save. Use after a config is updated in some way in-game. Does not perform any validation or reading/deleting of old or redundant files. This is used automatically by FzzyConfig when a client updates client-sided settings, receives an update from the server, or receives and accepts a forwarded setting; and also on the server when the server receives an update from a valid client.

Author

fzzyhmstrs

Since

0.2.0

Parameters

T

subclass of Config

configClass

instance of T to be saved

Samples

import me.fzzyhmstrs.fzzy_config.FC
import me.fzzyhmstrs.fzzy_config.api.ConfigApi
import me.fzzyhmstrs.fzzy_config.config.Config
import me.fzzyhmstrs.fzzy_config.config.ConfigSection
import me.fzzyhmstrs.fzzy_config.validation.collection.ValidatedIdentifierMap
import me.fzzyhmstrs.fzzy_config.validation.minecraft.ValidatedIdentifier
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedBoolean
import me.fzzyhmstrs.fzzy_config.validation.number.ValidatedDouble
import net.minecraft.item.Items
import net.minecraft.registry.Registries
import net.minecraft.registry.tag.ItemTags
import net.minecraft.util.Identifier

fun main() { 
   //sampleStart 
   /**
 * Saves the config to file.
 *
 * Called by FzzyConfig every time a config update is pushed from a client. Use if you have some custom method for altering configurations and need to save the changes to file. Only recommended to use this on the client for client-only settings
 *
 * Only automatically saves on the client-side if [NonSync][me.fzzyhmstrs.fzzy_config.annotations.NonSync] fields were altered.
 * @author fzzyhmstrs
 * @since 0.2.0
 */
fun save() {
    ConfigApi.save(this)
} 
   //sampleEnd
}